package com.partner.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLDecoder;

/**
 * 关于流的一些方法
 * @author Jinshuan
 *
 */
public class IOUtil {
	//将inputstream转为string
	public static String inputStreamToStream(InputStream is){
		InputStreamReader isr = new InputStreamReader(is);
		BufferedReader bufferedReader = new BufferedReader(isr);
		String result = "";
		String readline = null;
		try {
			while((readline = bufferedReader.readLine())!=null){
				result+=readline;
			}
			//将结果编码回去
			result = URLDecoder.decode(result, "utf-8");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return result;
	}
}
